package cn.com.cennavi.bean;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DiDiNewData1 implements Serializable {
	public String carID;
	public double lon;
	public double lat;
	static SimpleDateFormat sf = new SimpleDateFormat("yyyy/MM/dd,HH:mm:ss");
	/**
	 * 10位精确到秒
	 */
	public long timeStamp;
	/**
	 * kmph
	 */
	public double speed;
	/**
	 * gps点的方位角（-180-180）
	 */
	public double direction;
	/**
	 * gps点所属与的分歧点id
	 */
	public String difPointId;
	public static DiDiNewData1 parseData(String line) {
		if(line==null)return null;
		String[] arr = line.split(",");
		DiDiNewData1 didi = new DiDiNewData1();
		didi.carID = arr[0];
		didi.lon = Double.parseDouble(arr[1]);
		didi.lat = Double.parseDouble(arr[2]);
		didi.timeStamp = Long.parseLong(arr[3]);
		didi.speed =0;
		return didi;
	}
	public static DiDiNewData1 parseData1(String line) {
		String[] arr = line.split(",");
		if (arr.length != 6) {
			return null;
		}
		DiDiNewData1 didi = new DiDiNewData1();
		didi.carID = arr[0];
		didi.lon = Double.parseDouble(arr[1]);
		didi.lat = Double.parseDouble(arr[2]);
		didi.timeStamp = Long.parseLong(arr[3]);
		didi.speed = Double.parseDouble(arr[4]);
		didi.direction = Double.parseDouble(arr[5]);
		return didi;
	}
	public static String getDate(long t) {
		Date d = new Date();
		d.setTime(t * 1000);
		return sf.format(d);
	}

	public String toSting() {
		// TODO Auto-generated method stub
		return this.carID + "," + this.lon + "," + this.lat + "," + this.timeStamp + "," + this.speed;
	}
	public static void main(String []args){
		System.out.println(getDate(1466470755l));
	}
}
